package org.cancer.dao

import org.cancer.util.JDBCUtil

import java.sql.Connection

class CancersDao {
  // 表创建方法
  def insertPatientCount(cancers_type: String, day: String, province: String, count: Int, rank: Int): Unit = {

    val conn: Connection = JDBCUtil.getConnection
    try {
      JDBCUtil.executeUpdate(conn, "insert into cancers_high_area(cancers_type,dt,province,patient_count ) " +
        "values (?,?,?,?,?) on duplicate key update patient_count = ?,rank=?", Array(cancers_type, day, province, count, rank, count, rank)
      )
    } finally {
      conn.close()
    }
  }

}
